import LoginStateManager from 'utils/login-state'
import type { CXRequestConfig } from '../..'

/**
 * 请求拦截器----授权信息
 * @param {AxiosRequestConfig} value 请求配置
 * @returns {AxiosRequestConfig} 请求配置
 */
function AuthTokenInterceptor(value: CXRequestConfig): CXRequestConfig {
  // 添加 授权信息
  value.headers = {
    ...value.headers,
    Authorization: LoginStateManager.getToken(),
  }

  return value
}

export default AuthTokenInterceptor
